﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Dln.Common.Helper;
using Dln.Model;

public partial class Page_Community_UserInfo : BasePage
{
    protected string openid = string.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {
        //openid = GetAuthOpenId();
        openid = "oF6dUwxAa6BtWPqaRnE_lz7lDBgQ1";
        var uptModel = SqlHelper.Context.From<WeChatUsers>().Where(d => d.Openid == openid);
        if (uptModel == null && uptModel.Count() <= 0)
        {
            ResponseToPage("请关注德朗诺公众号！");
        }
        else
        {
            WeChatUsers model = uptModel.ToFirstDefault();

            if (model.RoleType == 0 && !string.IsNullOrEmpty(model.CardID))
            {
                this.Response.Redirect("/page/Community/DoctorIndex.aspx?openid=" + openid);
            }
            if (model.RoleType == 1 && !string.IsNullOrEmpty(model.CardID) && !string.IsNullOrEmpty(model.PatientID))
            {
                this.Response.Redirect("/page/Community/PatientIndex.aspx?openid=" + openid);
            }
        }
    }
}